package com.huiyujiaoyu.http;




import com.huiyujiaoyu.powertime.model.FileBean;
import com.huiyujiaoyu.powertime.model.IndexItemModel;
import com.huiyujiaoyu.powertime.model.LoginBean;
import com.huiyujiaoyu.powertime.model.SimpleBean;
import com.huiyujiaoyu.powertime.model.SimpleList2Bean;
import com.huiyujiaoyu.powertime.model.SimpleListBean;

import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import io.reactivex.Flowable;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

import static com.huiyujiaoyu.http.HttpApi.API_BUYCOLUMN;
import static com.huiyujiaoyu.http.HttpApi.API_CHAPTERS;
import static com.huiyujiaoyu.http.HttpApi.API_COLLECT;
import static com.huiyujiaoyu.http.HttpApi.API_COLLECTION;
import static com.huiyujiaoyu.http.HttpApi.API_COLUMN;
import static com.huiyujiaoyu.http.HttpApi.API_COL_INDEX;
import static com.huiyujiaoyu.http.HttpApi.API_COMMENT_INDEX;
import static com.huiyujiaoyu.http.HttpApi.API_COM_ADD;
import static com.huiyujiaoyu.http.HttpApi.API_COUPONS;
import static com.huiyujiaoyu.http.HttpApi.API_FEEDBACK;
import static com.huiyujiaoyu.http.HttpApi.API_FIND;
import static com.huiyujiaoyu.http.HttpApi.API_GETVERIFICATIONCODE;
import static com.huiyujiaoyu.http.HttpApi.API_HEADLINES;
import static com.huiyujiaoyu.http.HttpApi.API_HOT;
import static com.huiyujiaoyu.http.HttpApi.API_HOTKEYS;
import static com.huiyujiaoyu.http.HttpApi.API_INDEX;
import static com.huiyujiaoyu.http.HttpApi.API_KEYWORDSS;
import static com.huiyujiaoyu.http.HttpApi.API_LOGIN;
import static com.huiyujiaoyu.http.HttpApi.API_MESSAGES;
import static com.huiyujiaoyu.http.HttpApi.API_SCORE_LIST;
import static com.huiyujiaoyu.http.HttpApi.API_UPDATE;
import static com.huiyujiaoyu.http.HttpApi.API_UPLOADFILE;
import static com.huiyujiaoyu.http.HttpApi.API_UPLOADIMG;
import static com.huiyujiaoyu.http.HttpApi.API_USERINFO;
import static com.huiyujiaoyu.http.HttpApi.API_VIEW;
import static com.huiyujiaoyu.http.HttpApi.API_YZYZM;
import static com.huiyujiaoyu.http.HttpApi.HTTP_APK;
import static com.huiyujiaoyu.http.HttpApi.HTTP_INDEX;


/**
 * Created by yujunlong on 2016/11/11.
 */

public interface HttpService {

    //动态设置url
    @GET(HTTP_APK)
    Call<ResponseBody> loadFile(@Path(value = "end_url", encoded = true) String endurl);

    @Multipart
    @POST(API_UPLOADFILE)
    Flowable<FileBean> uploadfile(@Path("versionName") String versionName, @PartMap Map<String, Integer> params, @PartMap Map<String, RequestBody> files);

    //获取验证码
    @FormUrlEncoded
    @POST(API_GETVERIFICATIONCODE)
    Flowable<HttpResult<List<String>>> getVerificationCode(@FieldMap TreeMap<String, Object> map);
    //登录
    @FormUrlEncoded
    @POST(API_LOGIN)
    Flowable<HttpResult<LoginBean>> login(@FieldMap TreeMap<String, Object> map);
    //修改用户信息
    @FormUrlEncoded
    @POST(API_UPDATE)
    Flowable<HttpResult<List<String>>> update(@FieldMap TreeMap<String, Object> map);
    //首页
    @GET(API_INDEX)
    Flowable<HttpResult<SimpleListBean>> index(@QueryMap TreeMap<String, Object> map);
    //热门
    @GET(API_HOT)
    Flowable<HttpResult<SimpleListBean>> hot(@QueryMap TreeMap<String, Object> map);
    //热门头条
    @GET(API_HEADLINES)
    Flowable<HttpResult<SimpleListBean>> headlines(@QueryMap TreeMap<String, Object> map);

    //详情
    @GET(API_VIEW)
    Flowable<HttpResult<SimpleBean>> view(@QueryMap TreeMap<String, Object> map);
    //章节
    @GET(API_CHAPTERS)
    Flowable<HttpResult<List<IndexItemModel>>> chapters(@QueryMap TreeMap<String, Object> map);
    //评论
    @GET(API_COMMENT_INDEX)
    Flowable<HttpResult<SimpleListBean>> cIndex(@QueryMap TreeMap<String, Object> map);
    //评论
    @GET(API_COLLECT)
    Flowable<HttpResult<List<String>>> collect(@QueryMap TreeMap<String, Object> map);

    //发布评论
    @FormUrlEncoded
    @POST(API_COM_ADD)
    Flowable<HttpResult<List<String>>> comment(@FieldMap TreeMap<String, Object> map);

    //专栏
    @GET(API_COL_INDEX)
    Flowable<HttpResult<SimpleListBean>> column(@QueryMap TreeMap<String, Object> map);
    //发现
    @GET(API_FIND)
    Flowable<HttpResult<SimpleListBean>> find(@QueryMap TreeMap<String, Object> map);
    //发现
    @GET(API_HOTKEYS)
    Flowable<HttpResult<SimpleListBean>> hotkeys(@QueryMap TreeMap<String, Object> map);

    @FormUrlEncoded
    @POST(API_KEYWORDSS)
    Flowable<HttpResult<SimpleList2Bean>> keywordss(@FieldMap TreeMap<String, Object> map);

    //用户信息
    @GET(API_USERINFO)
    Flowable<HttpResult<LoginBean>> userinfo(@QueryMap TreeMap<String, Object> map);

    //用户信息
    @GET(API_MESSAGES)
    Flowable<HttpResult<SimpleListBean>> message(@QueryMap TreeMap<String, Object> map);

    @FormUrlEncoded
    @POST(API_UPLOADIMG)
    Flowable<HttpResult<SimpleBean>> uploadimag(@FieldMap TreeMap<String, Object> map);
    @FormUrlEncoded
    @POST(API_YZYZM)
    Flowable<HttpResult<List<String>>> yzyzm(@FieldMap TreeMap<String, Object> map);
    //我的订阅
    @GET(API_COLUMN)
    Flowable<HttpResult<List<IndexItemModel>>> oColumn(@QueryMap TreeMap<String, Object> map);
    //我的收藏
    @GET(API_COLLECTION)
    Flowable<HttpResult<SimpleListBean>> collections(@QueryMap TreeMap<String, Object> map);
    @GET(API_COUPONS)
    Flowable<HttpResult<SimpleListBean>> coupons(@QueryMap TreeMap<String, Object> map);
    @GET(API_BUYCOLUMN)
    Flowable<HttpResult<SimpleBean>> buycolumn(@QueryMap TreeMap<String, Object> map);
    @GET(API_SCORE_LIST)
    Flowable<HttpResult<SimpleListBean>> score_list(@QueryMap TreeMap<String, Object> map);
    @FormUrlEncoded
    @POST(API_FEEDBACK)
    Flowable<HttpResult<List<String>>> feedback(@FieldMap TreeMap<String, Object> map);
}
